package com.sjh.tomcat.servlet;

import com.sjh.tomcat.http.SjhRequest;
import com.sjh.tomcat.http.SjhResponse;

import java.io.IOException;

public abstract class SjhHttpServlet implements SjhServlet{

    @Override
    public void service(SjhRequest request, SjhResponse response) throws IOException {
        if("GET".equalsIgnoreCase(request.getMethod())){
            this.doGet(request, response);
        }else if("POST".equalsIgnoreCase(request.getMethod())){
            this.doPost(request, response);
        }
    }

    public abstract void doGet(SjhRequest request, SjhResponse response);

    public abstract void doPost(SjhRequest request, SjhResponse response);
}
